<%@page import="News.entity.Inland_News"%>
<%@page import="News.dao.impl.Inland_NewsDaoImpl"%>
<%@page import="News.dao.Inland_NewsDao"%>
<%@page import="News.service.Inland_NewsService"%>
<%@ page language="java" import="java.util.*,News.service.impl.Inland_NewsServiceImpl" pageEncoding="UTF-8"%>
<%
	session.getAttribute("del");
	//System.out.println("这是哪个会话中存的"del"的值="+sesvalue);
	Inland_NewsService INser = new Inland_NewsServiceImpl();
	String opr = request.getParameter("opr");
	if("sel".equals(opr)){//这再去查询 然后回到展示页
	List<Inland_News> InlandList = INser.findAllNewsInfo();
	session.setAttribute("InlandList", InlandList);
	response.sendRedirect("showInlandNews.jsp");
	}else if("del".equals(opr)){//接收到 了 opr是del
	int id = Integer.parseInt(request.getParameter("delid"));//拿出要删除的id（delid）里面存的对应的值 是上个页面那个变量newsid
		//所以那个会话中存的
		if(INser.delNewsById(id)){//把那个变量的值放进要删除的方法里
			response.sendRedirect("doInlandNews.jsp?opr=sel");//删除成功了 就访问本页面 带一个查询opr=sel
		}else{
			out.print("删除有误，请重试");
		}
	}else if("add".equals(opr)){
		int newsid = Integer.parseInt(request.getParameter("newsid"));
		String newscont = request.getParameter("newscont");
		String newstime = request.getParameter("newstime");
		int newsnor =Integer.parseInt(request.getParameter("newsnor"));
		if(INser.addNews(newsid, newscont, newstime, newsnor)){
			response.sendRedirect("doInlandNews.jsp?opr=sel");
			}else{
				out.println("请联系管理员");
			}
	}else if("upda".equals(opr)){
		int newsid = Integer.parseInt(request.getParameter("newsid"));
		String newscont = request.getParameter("newscont");
		String newstime = request.getParameter("newstime");
		int newsnor =Integer.parseInt(request.getParameter("newsnor"));
		if(INser.addNews(newsid, newscont, newstime, newsnor)){
			response.sendRedirect("doInlandNews.jsp?opr=sel");
			}else{
				out.println("修改错误！");			
			}
	}else{
		out.println("操作错误，请联系管理员");
	}

%>